<template>
<el-select :value="value" @input="handleValueChange" filterable placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
<script>
import global_ from '@/common/Global'
import {doRequestPost,doRequestGet, doRequestPut, doRequestDel} from '@/utils/request'

export default {
    created() {
        var self = this
        self.getOptions()
        
    },
    props: {
        value: {
            type: String 
        }
    },
    data() {
        return {
            options: [],
            posId: '',
        }
    },
    methods: {
        getOptions() {
            var self = this
            doRequestGet(global_.rest_path + '/auth/position/all', {}).then(
                (res) => {
                    //self.options = res.data.results.map((v) => {
                    self.options = res.Data.map((v) => {
                        return {
                            label: v.posName,
                            value: v.posId
                        }
                    })
                }
            )
        },
        handleValueChange(val) {
            var self = this 
            self.value = val
            self.$emit("input", val)
        }
    }
}


</script>